package com.bbcare.plat.consumer.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;

import com.bbcare.comm.Constants;
import com.bbcare.followup.plat.service.IScanDataSynchService;

@Service
public class ConsumerListener {

	@Autowired
    private IScanDataSynchService scanDataSynchService;
	

	public void doCosumer(String message) throws Exception {
		//从消息体中获取babyId
//    		String messageStr=new String(message.getBody()); 
		JSONObject data=JSONObject.parseObject(message);
		String mqType=(String)data.get(Constants.MQ_MESSAGE_TYPE);
		if(Constants.CONSUMER_TYPE_REGISTER_SERVER.equals(mqType)){//去开通
			scanDataSynchService.consumerAddPatientByScan(message);
		}else if(Constants.CONSUMER_TYPE_REGISTER_SERVER_MODIFY.equals(mqType)){
			scanDataSynchService.consumerModifyPatientByScan(message);
		}else if(Constants.CONSUMER_TYPE_QUESTION_CONTENT_SERVER.equals(mqType)){
			scanDataSynchService.consumerTaskContDataByScan(message);
		}
//        		vaccineRecordService.addVaccineRecord(babyId);
	}

}
